<?php

class SyncUserBehavior extends CUserBehavior{

	public function afterLogin($event) {
		$owner = $this->getOwner();
		$ucClient = Yii::app()->ucClient;
		$user = $ucClient->user->userLogin($owner->worker->worker_name, $owner->worker->worker_password);
		$sync = $ucClient->user->userSyncLogin($user->uid);
//		CVarDumper::dump($user->getErrorMsg());
		$sync->register();
	}
	
	public function afterLogout($event) {
		$ucClient = Yii::app()->ucClient;
		$sync = $ucClient->user->userSyncLogout();
		$sync->register();
	}
}

?>